from django.db import models
from django.utils import timezone


# Create your models here.
class User(models.Model):
    """用户表"""
    GENDER_CHOICE = (
        ('male', '男'),
        ('female', '女'),
        ('unknown', '未知'),
    )
    # 自增主键id，自动创建
    name = models.CharField('姓名', max_length=20)
    passworld = models.CharField('密码', max_length=20)
    hash_passwrod = models.CharField('哈希密码', max_length=128, null=True, blank=True)
    gender = models.CharField('性别', choices=GENDER_CHOICE, max_length=10, default=GENDER_CHOICE[2][1])
    email = models.CharField('邮箱', max_length=100, unique=True)
    register_time = models.DateTimeField('注册日期', default=timezone.now)

    # phone
    # last_login_time
    # is-active

    def __str__(self):
        return '<class User>'.format(self.name)


class Meta:
    # 元信息，可以不写
    verbose_name = '用户表'
